feat(loops): Run a skill instead of instructions#3741
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/ui/src/features/loops/components/LoopDetailView.tsx:325
**Missing bundles crash loop views**
When the older backend described in this PR omits `skill_bundles`, this unconditional `.length` access throws during rendering. The edit path also indexes the absent field in `primaryLoopSkillBundle`, so users cannot view or edit loops until the backend deployment completes.
### Issue 2 of 2
packages/ui/src/features/loops/components/LoopForm.tsx:145-153
**Failed uploads leave incomplete loops**
When dependency resolution, local bundling, or bundle upload fails, the loop has already been persisted with `/skill-name` instructions, and this catch only shows a toast before navigating away. The loop can then fire without the matching skill artifact, causing the run to receive the invocation without the selected skill definition.
Reviews (1): Last reviewed commit: "let loops run a skill instead of instruc..." | Re-trigger Greptile |
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 3 · PR risk: 0/10 |
|
👋 Visual changes detected for this PR. Review and approve in PostHog Visual Review If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix. |
b6e12fd to
1c13ce3
Compare
1c13ce3 to
1d0f2a9
Compare
Problem
A loop's prompt is a free-form instructions blob. Teams that already maintain skills have no way to point a loop at one, so the same playbook gets pasted into instructions and drifts from the skill.
Changes
The loop form's prompt step gains a source choice: write instructions or run a skill. Picking a local skill zips it (plus its skill dependencies) via workspace-server on save and uploads the set through the new
PUT /loops/{id}/skill_bundles/endpoint, and the loop's instructions become/skill-nameplus an optional context field. The backend seeds those bundles into every fired run, where the sandbox agent-server already installsskill_bundleartifacts.The loop detail page shows the attached skill with its snapshot digest and an "Update from local skill" button to re-snapshot after editing the skill. On hosts without a local filesystem (web) the picker is hidden; an attached skill can still be kept or detached.
Requires PostHog/posthog#73069 to be deployed first; until then the skill_bundles endpoint 404s and
loop.skill_bundlesis absent.How did you test this?
Unit tests for the new instruction build/parse helpers and the form round-trip (skill mode validity, derived instructions, attached-snapshot mapping) via
pnpm --filter @posthog/ui test. Fullpnpm typecheckand Biome lint are clean. Not exercised against a live backend since the API only exists in the paired posthog PR.Automatic notifications